/*
#Copyright (c) 2013, Philippe Bordron <philippe.bordron@gmail.com>
#
# This file is part of SIPPER.
#
# DCC is free software: you can redistribute it and/or modify
# it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# DCC is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU LESSER GENERAL PUBLIC LICENSE for more details.
#
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
# along with SIPPER.  If not, see <http://www.gnu.org/licenses/>
*/
package combi.wip.sipper.modeling.reactions;

import java.util.Collection;
import java.util.HashSet;
import java.util.Set;


public class FilteredReaction<C> extends Reaction<C> {

	protected Collection<C> filter;

	public FilteredReaction(Reaction<C> r, Collection<C> filter)
	{
		super(r);
		this.filter = filter;
	}

	protected Set<C> filter(Collection<C> cpds)
	{
		Set<C> result = new HashSet<C>(cpds);
		result.removeAll(filter);
		return result;
	}
	
	@Override
	public Set<C> getLeftPart() {
		return filter(super.getLeftPart());
	}
	
	@Override
	public Set<C> getRightPart() {
		return filter(super.getRightPart());
	}
}
